<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<jsp:include page="/WEB-INF/jsp/common/_head.jsp"/>
<%@ include file="/WEB-INF/jsp/common/_includes.jsp" %>
<div class="ui grid">
    <div class="row">
        <div class="column">
            <div class="ui two column grid">
                <div class="three wide column">
                    <jsp:include page="/WEB-INF/jsp/common/_sidebar.jsp">
                        <jsp:param name="index" value="4"/>
                    </jsp:include>
                </div>
                <div id="container" class="thirteen wide column">
                    <ol class="breadcrumb">
						<li><a href="/user/list">后台管理</a></li>
						<li class="active">用户管理</li>
					</ol>
                    <ul class="nav nav-pills" role="tablist">
                        <li role="presentation" class="active"><a href="/user/add">录入用户</a></li>
                    </ul>
					<ul class="nav nav-pills" role="tablist">
						<li role="presentation" class="active">
							<form class="navbar-form navbar-left" role="search">
								<div>
									<div class="form-group">
										<input type="text" class="form-control" name="kw"
											value="${not empty param.kw ? param.kw : ''}"
											placeholder="请输内容标题">
									</div>
									<button type="submit" class="btn btn-default">搜索</button>
								</div>
							</form>
						</li>
					</ul>
					<table class="table table-hover">
                        <thead>
                        <tr>
                            <th>用户名</th>
                             <th>昵称</th>
                            <th>性别</th>
                            <th>注册类型</th>
                            <th>创建时间</th>
                             <th>更新时间</th>
                            <th>推荐客服id</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${paginate.pageList}" var="user">
                            <tr>
                                <td>   <a   href="/user/${user.id}/details">${user.userName}</a></td>
                                 <td>${user.nickName}</td>
                                <td>
                                     <c:choose>
                                               <c:when test="${user.gender==1}">男</c:when>                                     
                                               <c:when test="${user.gender==0}">女</c:when>                                        
                                     </c:choose>
                                </td>
                                <td>
                                      <c:choose>
                                               <c:when test="${user.registerType==1}">邮箱注册</c:when>                                     
                                               <c:when test="${user.registerType==0}">手机注册</c:when>                                        
                                     </c:choose>
                                </td>
                                	<td><fmt:formatDate value="${user.createTime}" pattern="yyyy-MM-dd"/></td>
                                	<td><fmt:formatDate value="${user.updateTime}" pattern="yyyy-MM-dd"/></td>
                                 <td>${user.recommendUserId }</td>
                                <td>
                                    <a class="btn active btn-primary" onclick="return confirm('确实要编辑吗？')" href="/user/${user.id}/edit">编辑</a>
                                    <a class="btn active btn-danger" onclick="return confirm('确实要删除吗？')" href="/user/${user.id}/del">删除</a>
                                    <a class="btn active btn-danger" onclick="return confirm('确实要修改密碼吗？')" href="/user/${user.id}/passwordEdit">密码修改</a>
                           </td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                    <div class="page-info clearfix">
                         <jsp:include page="/WEB-INF/jsp/common/_page.jsp"/>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<jsp:include page="/WEB-INF/jsp/common/_foot.jsp"></jsp:include>
<script type="text/javascript">
	$(function(){
		$('a.btn-success,a.btn-danger,a.btn-warning,a.js_internal').click(function(){
			var obj = $(this);
			var isAudit = obj.attr("isAudit");
			var title = obj.attr("title");
			var label = obj.attr("label");
			Confirm(title, label, function(){
				 $('#js_submit').button('loading');
				 $.get(obj.attr("ref"), {isAudit:isAudit}, function(res){
					$('#js_submit').button('reset');
					if(res.status == 'ok'){
						success(res.message);
						setTimeout(window.location.reload(),1000);
					}else{
						error(res.message);
						setTimeout(window.location.reload(),1000);
					}
				}); 
			});
		});
	});
</script>
